{% load i18n %}
{% load staticfiles %}
<!DOCTYPE html>
{%  get_current_language as LANGUAGE_CODE %}
<html lang="zh">
<head>

    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta name="format-detection" content="telephone=no" />
{#    <link rel="shortcut icon" href='../../static/niji/image/logo2.png' />#}
    <!--必须添加一个动态的地址 不然不在同一目录下的文件找不到资源 -->
    <link rel="shortcut icon" href="{% static 'niji/image/logo2.png' %}" />
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" crossorigin="anonymous">



    <!--必须添加一个动态的地址 不然不在同一目录下的文件找不到资源 -->
    <link rel="stylesheet" href="{% static 'niji/css/main.css' %}">
{#<link rel="stylesheet" href="../../static/niji/css/main.css">#}
    <title>{{ title }} {% if site_name %} -{{ site_name}} {% endif %} </title>

    <script type="text/javascript" charset="utf-8" src="{% static 'ueditor/ueditor.config.js' %}"></script>
    <script type="text/javascript" charset="utf-8" src="{% static 'ueditor/ueditor.all.min.js' %}"></script>



</head>
<body>


<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{% url 'niji:index' %}">{% if site_name %}{{ site_name }}{% else %}NIJI{% endif %}</a>
        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class=""><a href="{% url 'niji:index' %}">{% trans 'home' %}</a></li>
            </ul>
            <form class="navbar-form navbar-left" role="search" action="{% url 'niji:search_redirect' %}">
                <div class="form-group">
                    <input type="text" id="keywordInput" name="keyword" class="form-control" placeholder="{% trans 'Search' %}">
                </div>
                <button type="submit" id="navSearchBtn" class="btn btn-default">{% trans 'Search' %}</button>
            </form>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

<div id="main" class="container">
    <div class="row">
        <div class="col-lg-8">
            {% block left %}{% endblock %}
        </div>
    <div class="col-lg-4">
        {% block widgtet_before %}
        {% endblock %}
        {% if request.user.is_authenticated %}
            {% include 'niji/widgets/authenticated_user_panel.html' %}
            {% else %}
                {% include 'niji/widgets/visitor_user_panel.html' %}
    {% endif %}
    {%  include 'niji/widgets/nodes.html' %}
    {% block widget_after %} {% endblock %}
    </div>
    </div>
</div>


<!-- 换成百度的jquery地址 不然用不了 -->
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
{#<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.2.4.min.js"></script>#}
{#<script src="//code.jquery.com/jquery-2.2.0js"></script>#}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" crossorigin="anonymous"></script>
<script>
    $(document).ready(function(){
        $('#navSearchBtn').click(function(e){
            e.preventDefault();
            var keyword = $('#keywordInput').val();
            if(keyword){

                window.location = "/search/" + keyword +"/";
                {#console.log('keyword: ' + keyword)#}
                <!--想用django的代码在js里面看看效果 感觉很奇怪 有时可以 有时不行 可能还是编译的问题 -->
{#                {% url 'niji:search' keyword=keyword %}#}


                // FIXME: Use url tag!


            }
        });
    });
</script>

{%  block footer_ext %} {% endblock %}
</body>
</html>